#include "Student_t.h"
#include "Student_tFactory.h"
#include "Student_tImpl.h"
#include "Observer.h"
#include "Subject.h"

Student_t::~Student_t()  {
	sbj ->Detach(this); 
	delete m_Student_t;
	m_Student_t=0;
}

Student_t::Student_t(Subject * s, const string& Impl, const long & id) { 
	m_Student_t = Student_tFactory::CreateStudent_t(Impl, id);
	sbj = s;
	sbj ->Attach(this); 
} 

void Student_t::Update (Subject* ChngSubject, const string & notification, const string & details) {
	if (ChngSubject == sbj ) {
		if (m_Student_t->getFaculty() == "FOH")
			if (notification == "Lecture Cancelled")
				return;
		cout << "Student " << m_Student_t->getId() << " is informed : " << notification << " : " << details << endl; 
	}
} 

void Student_t::tell() {
	m_Student_t->tell(); 
}

int Student_t::getId() const {
	return m_Student_t->getId();
}